///************************************************************************
/// <copyrigth>2018-2019 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// It is test ui 
///</describe>
/// <date>2020/7/26</date>
///***********************************************************************
#ifndef FRAMEUI_H
#define FRAMEUI_H

#include <QMainWindow>
#include <QMouseEvent>
#include <QLabel>
#include <QPoint>
#include "ui_Test.h"
#include "Tool/Toolkit.h"
#include "Model/ITest.h"
#include "PluginPtr.h"
#include "IFrameUI.h"

using namespace Ui;

class FrameUI :public QMainWindow, public IFrameUI
{
	Q_OBJECT

public:
    // Construct the test ui
	FrameUI(QWidget* parent = NULL);

    // Destruct the test ui
    virtual ~FrameUI();

public:
	// Set system ui
	virtual void SetSystemUI(ISystemUI* pUI);

    // Start the plugin
    virtual bool Start();

    // Stop the plugin
    virtual bool Stop();

private slots:
	// Close system
	void CloseSystem();

	// Show test
	void ShowTest1();

	// Show test
	void ShowTest2();

	// Show test
	void ShowTest3();

private:
	// Set lable icon
	void SetLabelIcon(QLabel* pLabel, QString strIconPath);

	// Init listen
	void InitListen();

	// Listen test plugin
	void ListenTest(EventPara& Para);

	// Run test task
	void RunTestTask();

private:
	// Init the UI
	void Initialize();

	// Destory the UI
	void Destory();

	// Init UI
	void InitUI();

    // Create main ui
    void CreateUI();

    // Destroy main ui
    void DestoryUI();

	// Create test plugin
	void CreateTestPlugin();

	// Destory the test plugin
	void DestoryTestPlugin();

private:
    // Get main ui
    inline MainWindow* GetUI() const
    {
        return m_pUI;
    }

    // Set main ui
    inline void SetUI(MainWindow* pUI)
    {
        m_pUI = pUI;
    }

	// Get system ui
	inline ISystemUI* GetSysUI() const
	{
		return m_pSysUI;
	}

	// Set system ui
	inline void SetSysUI(ISystemUI* pUI)
	{
		m_pSysUI = pUI;
	}

	//Get the Disposed
	bool GetDisposed() const
	{
		return m_bDisposed;
	}

	//Set the Disposed
	void SetDisposed(bool bDisposed)
	{
		m_bDisposed = bDisposed;
	}

private:
    // UI that you design byself
	MainWindow* m_pUI;

	// System ui
	ISystemUI* m_pSysUI;

	// Test module
	PluginPtr<ITest> pTestPlugin;

	// Disposed status
	bool m_bDisposed;
};

#endif // FRAMEUI_H
